package cn.bugstack.domain.activity.service.discount;


import cn.bugstack.domain.activity.model.valobj.GroupBuyActivityDiscountVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

@Slf4j
@Service("ZJ")
public class ZJCalculateService extends AbstractDiscountCalculateService {




    @Override
    protected BigDecimal doCalculate(BigDecimal originalPrice, GroupBuyActivityDiscountVO.GroupBuyDisCount groupBuyDisCount) {
        String marketExpr = groupBuyDisCount.getMarketExpr();
        BigDecimal zjPrice = originalPrice.subtract(new BigDecimal(marketExpr));
        if(zjPrice.compareTo(BigDecimal.ZERO) <= 0){
            return new BigDecimal("0.01");
        }
        return zjPrice;
    }
}
